package com.example.goods_manage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.goods_manage.dto.Goods;
import com.example.goods_manage.dto.User;
import com.example.goods_manage.mapper.UserMapper;
import com.example.goods_manage.service.IUserService;
import com.example.goods_manage.utils.AjaxResult;
import com.example.goods_manage.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2024-09-05
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public AjaxResult findUser(User user) {
        Page<User> page = new Page<>(user.getPageNum(), user.getPageSize());
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        IPage<User> userIPage = userMapper.selectPage(page, queryWrapper);
        PageUtils pageUtils = new PageUtils((Page) userIPage);
        return AjaxResult.success(pageUtils);
    }
}
